Skip to content

Add biometric sign-in and settings test coverage#717

Closed
softartdev wants to merge 1 commit intodevfrom
codex/add-tests-for-signinviewmodel-and-ui
Closed

Add biometric sign-in and settings test coverage#717
softartdev wants to merge 1 commit intodevfrom
codex/add-tests-for-signinviewmodel-and-ui

Conversation

@softartdev
Copy link
Copy Markdown
Owner

Motivation

  • Provide deterministic, testable biometric behavior for sign-in and settings so host and JVM UI tests can exercise success, cancellation, hard-failure and fallback flows.
  • Ensure the settings screen can represent and toggle biometric availability and enablement state so lifecycle and unsupported-device cases are covered.
  • Surface a biometric action and UI affordance on the sign-in screen to validate visibility and UX-preservation when biometric is unavailable.

Description

  • Add BiometricAuthenticator and BiometricAuthResult to presentation.signin and wire a OnBiometricSignInClick action into SignInViewModel with signInWithBiometric() handling success, cancel and error paths, and exposing isBiometricAvailable for the UI.
  • Add BiometricSettingsGateway and integrate it into SettingsViewModel with a ToggleBiometric action and biometricSupported/biometricEnabled fields on SettingsResult for state propagation.
  • Add a biometric button and test tag (SIGN_IN_BIOMETRIC_BUTTON_TAG) to the sign-in UI (SignInScreen) and update shared Koin modules to provide no-op implementations so existing app wiring stays functional without platform biometric implementations.
  • Add tests colocated with existing suites: host tests in core/presentation/src/androidHostTest (SignInViewModelTest, SettingsViewModelTest) covering biometric success/cancel/error/fallback and settings enable/disable/unsupported-device behavior, and a JVM Compose UI test in core/ui/src/jvmTest (SignInScreenBiometricTest) covering biometric button visibility and fallback UX preservation.

Testing

  • Added the following automated tests (not executed to completion in this environment): SignInViewModelTest (biometric success/cancel/error/fallback), SettingsViewModelTest (biometric enable/disable lifecycle and unsupported-device behavior), and SignInScreenBiometricTest (UI visibility and password UX preservation).
  • Attempted to run ./gradlew :core:presentation:androidHostTest :core:ui:jvmTest --no-daemon but the build failed in this environment due to a plugin resolution error for org.gradle.kotlin.kotlin-dsl (plugin artifact could not be resolved), so tests were not run here.
  • All new tests are colocated with existing suites under core/presentation/src/androidHostTest and core/ui/src/jvmTest so they will run in CI or a developer environment where Gradle can resolve plugins and device/emulator requirements are met.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f45c1498f4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

CountingIdlingRes.increment()
mutableStateFlow.value = SignInResult.ShowProgress
try {
when (val result = biometricAuthenticator.authenticate()) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Catch exceptions from biometric authentication

signInWithBiometric() only handles BiometricAuthResult.Error, but biometricAuthenticator.authenticate() itself is not wrapped in a catch. If a platform authenticator throws (for example, prompt/runtime failures), the exception escapes viewModelScope and can crash the sign-in flow instead of showing the existing error dialog path used by password sign-in. Please catch thrown exceptions around authenticate() and route them through the same error handling path.

Useful? React with 👍 / 👎.

@softartdev softartdev closed this Apr 27, 2026
@softartdev softartdev deleted the codex/add-tests-for-signinviewmodel-and-ui branch April 27, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant